/* GUI CONVERTED from rprrrp.p (converter v1.75) Sat Aug 12 23:11:42 2000 */
/* rprrrp.p - RESOURCE REQUIREMENT REPORT                               */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/* web convert rprrrp.p (converter v1.00) Fri Oct 10 13:57:19 1997 */
/* web tag in rprrrp.p (converter v1.00) Mon Oct 06 14:17:45 1997 */
/*F0PN*/ /*K1DK*/ /*                                                    */
/*V8:ConvertMode=FullGUIReport                                 */
/* REVISION: 1.0     LAST MODIFIED: 05/12/86    BY: PML       */
/* REVISION: 1.0     LAST MODIFIED: 09/16/86    BY: EMB *12*  */
/* REVISION: 2.0     LAST MODIFIED: 03/02/88    BY: EMB *A76* */
/* REVISION: 4.0     LAST MODIFIED: 02/24/88    BY: WUG *A175**/
/* REVISION: 5.0     LAST MODIFIED: 09/26/90    BY: RAM *B793**/
/* REVISION: 8.6     LAST MODIFIED: 12/11/97    BY: bvm *K1DK**/
/* REVISION: 9.1     LAST MODIFIED: 03/24/00    BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1     LAST MODIFIED: 08/12/00    BY: *N0KP* myb              */

/*K1DK*/ /* DISPLAY TITLE */

/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

/*K1DK*/ {mfdtitle.i "b+ "}

define variable part like rq_part.
define variable part1 like rq_part.
define variable site like rq_site.
define variable site1 like rq_site.
define variable rsc like rq_rsc.
define variable rsc1 like rq_rsc.
define variable start like tr_date.
define variable rqend like rq_end.
define variable desc1 like pt_desc1.
define variable desc2 like pt_desc1.
define variable rsdesc like rs_desc.
define variable last_part like rq_part.
define variable um like rs_um.

/*K1DK* /* DISPLAY TITLE */
 * {mfdtitle.i "b+ "} */

site = global_site.
site1 = global_site.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
part           colon 15
   part1          label {t001.i} colon 49 skip
   site           colon 15
   site1          label {t001.i} colon 49 skip
   rsc            colon 15
   rsc1           label {t001.i} colon 49 skip
   start          colon 15
   rqend          label {t001.i} colon 49 skip
 SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

/*K1DK*/ {wbrp01.i}


/*GUI*/ {mfguirpa.i true  "printer" 132 }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:

   if part1 = hi_char then part1 = "".
   if site1 = hi_char then site1 = "".
   if rsc1 = hi_char then rsc1 = "".
/*B793*    if start = low_date then start = ?. */
/*B793*    if rqend = hi_date then rqend = ?. */

/*K1DK*/ if c-application-mode <> 'web' then
   
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


/*K1DK*/ {wbrp06.i &command = update &fields = "  part part1 site site1 rsc
          rsc1 start rqend" &frm = "a"}

/*K1DK*/ if (c-application-mode <> 'web') or
/*K1DK*/ (c-application-mode = 'web' and
/*K1DK*/ (c-web-request begins 'data')) then do:

   bcdparm = "".
   {mfquoter.i part   }
   {mfquoter.i part1  }
   {mfquoter.i site   }
   {mfquoter.i site1  }
   {mfquoter.i rsc    }
   {mfquoter.i rsc1   }
   {mfquoter.i start  }
   {mfquoter.i rqend  }

   if part1 = "" then part1 = hi_char.
   if site1 = "" then site1 = hi_char.
   if rsc1 = "" then rsc1 = hi_char.
/*B793*    if start = ? then start = low_date. */
/*B793*    if rqend = ? then rqend = hi_date. */

/*K1DK*/ end.

   /* SELECT PRINTER  */
   
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i  "printer" 132}
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:




   {mfphead.i}

   last_part = ?.

   for each rq_mstr where (rq_rsc >= rsc and rq_rsc <= rsc1)
   and (rq_part >= part and rq_part <= part1)
   and (rq_site >= site and rq_site <= site1)
/*B793*    and (rq_start >= start and rq_end <= rqend) */
/*B793*/   and (rq_start <= rqend or rq_start = ? or rqend = ?)
/*B793*/   and (rq_end >= start or rq_end = ? or start = ?)
   no-lock break by rq_part by rq_site by rq_rsc by rq_end
   with width 132 frame b down no-attr-space:

      /* SET EXTERNAL LABELS */
      setFrameLabels(frame b:handle).

      um = "".
      rsdesc = "".
      find rs_mstr where rs_rsc = rq_rsc
      and rs_site = rq_site
      no-lock no-error.
      if available rs_mstr then rsdesc = rs_desc.
      if available rs_mstr then um = rs_um.

      if first-of(rq_part) then do:
     desc1 = "".
     desc2 = "".
     find pt_mstr where pt_part = rq_part no-lock no-error.
     if available pt_mstr
     then assign desc1 = "   " + pt_desc1
             desc2 = "   " + pt_desc2.

     if page-size - line-counter < 2
     or (page-size - line-counter < 3 and desc2 = "")
     then page.

     display rq_part format "x(27)"
        rq_site rq_rsc rsdesc rq_qty um
        rq_lead rq_lt_off rq_start rq_end WITH STREAM-IO /*GUI*/ .

      end.
      else do:
     if desc1 > "" then do:
        display desc1 @ rq_part WITH STREAM-IO /*GUI*/ .
        desc1 = "".
     end.
     else if desc2 > "" then do:
        display desc2 @ rq_part WITH STREAM-IO /*GUI*/ .
        desc2 = "".
     end.

     display rq_site rq_rsc rsdesc rq_qty
        um rq_lead rq_lt_off rq_start rq_end WITH STREAM-IO /*GUI*/ .
      end.

      if last-of(rq_part) then do:
     if desc1 > "" then do:
        down 1.
        display desc1 @ rq_part WITH STREAM-IO /*GUI*/ .
        desc1 = "".
     end.
     if desc2 > "" then do:
        down 1.
        display desc2 @ rq_part WITH STREAM-IO /*GUI*/ .
        desc2 = "".
     end.
     down 1.
      end.

      
/*GUI*/ {mfguirex.i } /*Replace mfrpexit*/

   end.

   /* REPORT TRAILER */
   
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/


end.

/*K1DK*/ {wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" part part1 site site1 rsc rsc1 start rqend "} /*Drive the Report*/
